package com.hui.blog_server.controller;

import com.hui.blog_server.entity.ResponseResult;
import com.hui.blog_server.service.impl.FileServiceImpl;
import org.springframework.web.bind.annotation.*;

import java.util.List;

/**
 * @author 彩色的小灰
 */
@RestController
@RequestMapping("/folders")
public class FileController {

    private final FileServiceImpl fileServiceImpl;

    public FileController(FileServiceImpl fileServiceImpl) {
        this.fileServiceImpl = fileServiceImpl;
    }

    // 接口一：获取指定文件夹下所有子文件夹名称
    @GetMapping("/subfolders")
    public ResponseResult<List<String>> getSubFolderNames(@RequestParam String folderPath) {
        List<String> folderNames = fileServiceImpl.getSubFolderNames(folderPath);
        return ResponseResult.success(folderNames);
    }
}